package ru.urfc.portal.ui.client.renderers.colorers;

import ru.urfc.portal.ui.client.Style;
import ru.urfc.portal.ui.client.descriptor.GridField;

import com.extjs.gxt.ui.client.data.ModelData;
import com.google.gwt.dom.client.Element;

public class RedGreenColorer extends BaseColorer {
	
	public RedGreenColorer(GridField field, Element element, Style style) {
		super(field, element, style);
	}

	@Override
	public void colorElements(ModelData modelData) {
		Double value = field.getValue(modelData);
		if (value != null) { 
			element.setClassName(value < 0? style.colorerRed(): style.colorerGreen());
		}
	}

}
